{extend name='tpl'/}
{block name='cart'}
		<!--中间开始-->
		<div id="content">
			<form action="" method="post">
				
				
			<div class="car main">
				<div class="carshop">
					<div class="cartitle">
						<div class="carcheck">
							<div class="checkbox">
								<span class="check checkon" id="allcheck"></span>

							</div>
							全选</div>
						<div class="carname">商品名称</div>
						<div class="carmoney">单价</div>
						<div class="carnum">数量</div>
						<div class="carcount">小计</div>
						<div class="carhandle">操作</div>
					</div>
					{foreach name="data['goods']" key='k' item='vo'}
					<div class="shopcontent">
						<div class="shopcheck"><div class="checkbox">
								<span class="check " sid="<?php echo $k ?>"></span>
								<input type="checkbox" name='checkbox' class="checkhide"/>
							</div></div>
						<div class="shopname">
							<div class="carimg">
								<a href=""><img src="{$vo['options']['img']}"/></a>
							</div>
							<p>
								<a href="#">{$vo['name']}</a>
								<span>{$vo['options']['color']}--{$vo['options']['size']}</span>
							</p>
						</div>
						<div class="shopmoney">{$vo['price']}</div>
						<div class="shopnum">
							
							<a href="javascript:;" class="num_l">-</a>
							<input type="text" value="{$vo['num']}" />
							<a href="javascript:;" class="num_r" sid="{$k}">+</a>
						</div>
						<div class="shopcount">{$vo['total']}</div>
						<div class="shophandle" ><span sid="{$k}">x</span></div>
					</div>
					{/foreach}
				</div>
				<div class="jiesuan">
					<div class="jixu"><a href="">继续购物</a></div>
					<div class="gongji">共计<span>{$data['total_rows']}</span>件商品</div>
					<div class="heji">合计<span>{$data['total_price']}</span></div>
					<div class="gou"><input type="button" value="去结算"/></div>
					
				</div>
			</div>
			</form>
			<script>
				$(function(){
					$('.gou').click(function () {
						var len = $('.shopcontent .checkon').length;
						if(len==0){
							layer.msg('请选择相对应的商品信息',function(){
								return false;
							})
						};
						//走到这里说明可以正常去结算
						var sid = '';
						$('.shopcontent .checkon').each(function(k,v){
//							alert($(this).attr('sid'))
							sid +=$(this).attr('sid') + '|';
						})
//						alert(sid);
						//向PHP发送请求
						$.post("{:url('index/orders/addOrders')}",{sid:sid},function(responce){
							location.href = "{:url('index/orders/index')}"
						},'json')
					})
				})
			</script>
		</div>
		</div>
		<!--中间结束-->

{/block}